const pkg = require('../package.json')
import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import Element from 'element-ui'
import Card from './components/Card'// 全局注册card组件
import './styles/element-variables.scss'
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import VueCompositionAPI from '@vue/composition-api'
import hooks from '@u3u/vue-hooks'
Vue.use(hooks)
Vue.use(VueCompositionAPI)
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import * as filters from './filters' // global filters
import TreeSelect from './components/TreeSelect/index'// 全局注册树形select组件
import TSelect from './components/TSelect/index'
import StatesSelect from './components/StatesSelect/index'
import BillTemplateTypeSelect from './components/BillTemplateTypeSelect/index'
import ProductSelect from './components/ProductSelect/index'
import DepartmentSelect from './components/DepartmentSelect/index'
import VueCurrencyFilter from 'vue-currency-filter'
import DistrictPicker from './components/DistrictPicker/index'
import DateRangePicker from './components/DateRange/index'
import RemoteDate from './components/RemoteDate/index'
import DataSources from './components/DataSources/index'
import DepartmentTreeSelect from './components/DepartmentSelect/index'
import DisplaySetting from '@/components/DisplaySetting/index'
import BlSelect from '@/components/bl-select/index'

import diytable from './directive/diy-table/index'
import dayJs from 'dayjs'
import _ from 'lodash'

Vue.component('DistrictPicker', DistrictPicker)
Vue.component('TSelect', TSelect)
Vue.component('BlSelect', BlSelect)
Vue.component('StatesSelect', StatesSelect)
Vue.component('BillTemplateTypeSelect', BillTemplateTypeSelect)
Vue.component('ProductSelect', ProductSelect)
Vue.component('DepartmentSelect', DepartmentSelect)
Vue.component('DateRangePicker', DateRangePicker)
Vue.component('RemoteDate', RemoteDate)
Vue.component('DataSources', DataSources)
Vue.component('DepartmentTreeSelect', DepartmentTreeSelect)
Vue.component('DisplaySetting', DisplaySetting)
Vue.directive('diytable', diytable)

Vue.prototype.$dayJs = dayJs
Vue.prototype._ = _
Vue.prototype.baseurl = localStorage.getItem('api') || pkg.baseurl
console.log(pkg.inversion)
Vue.use(Element, {
  size: Cookies.get('size') || 'small' // set element-ui default size
})
Vue.use(Card)
Vue.use(TreeSelect)
Vue.use(VueCurrencyFilter,
  {
    symbol: '',
    thousandsSeparator: ',',
    fractionCount: 2,
    fractionSeparator: '.',
    symbolPosition: 'front',
    symbolSpacing: true
  })
// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
Vue.config.productionTip = false
Vue.prototype.sysname = '资金支出控制系统'
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
